import java.util.Stack;

class MinStack1 {
    private Stack<Integer> stack;
    private Stack<Integer> minstack;

    public MinStack1() {
        stack=new Stack<>();
        minstack=new Stack<>();
        System.out.println("null");
    }
    
    public void push(int val) {
        stack.push(val);
        if(minstack.empty()){
            minstack.push(val);
        }else{
            if(val>=minstack.peek()){
                minstack.push(val);
            }
        }
        System.out.println("null");
    }
    
    public void pop() {
        if(!stack.empty()){
            int tmp=stack.pop();
            if(tmp==minstack.peek()){
                minstack.pop();
            }
        }else{
            return ;
        }
        System.out.println("null");
    }
    
    public int top() {
        if (!stack.empty()){
            return stack.peek();
        }
        else {
            return -1;
        }
    }
    
    public int getMin() {
        if (!stack.empty()){
            return minstack.peek();
        }
        else {
            return -1;
        }
    }
}
